# Follow The Wall
Instead of moving the robot with hardcoded steps, we can use feedback from the ultrasonic sensor to make navigation decisions. At every loop iteration, we read the distance to the top wall and decide how to move the motors based on that distance.
For example: if the distance is greater than 110cm, turn left; if less than 110cm, turn right.
Exercise
The coins are around 110 cm away from the top wall. Use data from the ultrasonic sensor to navigate the robot and collect both coins.
HINT
If you just rotate the robot left and right, you won't get closer or farther from the wall—you'll only change direction. Instead, think about gently biasing the wheel speeds so you glide toward the wall while staying mostly parallel. One simple sequence you can experiment with is:
1. Ease left by slowing the left wheel briefly → drive(120, 180)
2. Nudge forward a little faster → drive(150, 150)
3. Straighten out with a small right correction → drive(170, 130)
Treat the numbers as a starting point only—adjust the relative speeds and durations until the robot slides closer to the wall without swinging wildly.
What Methods Did You Use?
What motor-control strategy did you end up using to stay alongside the wall? How does it work? Try to explain using the methods implemented into your coded solution.